<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/19 0019
  Time: 9:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>编辑客户</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<form class="layui-form">
    <input type="hidden" name="id" value="${customer.id}">
    <div class="layui-form-item" style="background: yellow;width: 900px">
        <label class="layui-form-label" >公司信息</label>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">客户名称*：</label>
        <div class="layui-input-inline">
            <input type="text" name="name" value="${customer.name}" autocomplete="off" placeholder="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">公司电话：</label>
            <div class="layui-input-inline">
                <input type="text" name="company_phone" value="${customer.company_phone}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户状态：</label>
            <div class="layui-input-inline">
                <select name="status">
                    <option value=""  <c:if test="${customer.status==''}">selected</c:if>>请选择</option>
                    <option value="0" <c:if test="${customer.status==0}">selected</c:if>>成交客户</option>
                    <option value="1" <c:if test="${customer.status==1}">selected</c:if>>潜在客户</option>
                    <option value="2" <c:if test="${customer.status==2}">selected</c:if>>意向客户</option>
                    <option value="3" <c:if test="${customer.status==3}">selected</c:if>>失败客户</option>
                    <option value="4" <c:if test="${customer.status==4}">selected</c:if>>已流失客户</option>
                </select>
            </div>
            <div class="layui-form-mid" style="color: cornflowerblue">+编辑</div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">意向产品：</label>
            <div class="layui-form-mid layui-word-aux">产品名称</div>
            <div class="layui-form-mid" style="color: cornflowerblue">+选择</div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" style="margin-left: 85px">客户类别：</label>
            <div class="layui-input-inline">
                <select name="type">
                    <option value="" <c:if test="${customer.type==''}">selected</c:if>>请选择</option>
                    <option value="1" <c:if test="${customer.type==1}">selected</c:if>>普通客户</option>
                    <option value="2" <c:if test="${customer.type==2}">selected</c:if>>VIP客户</option>
                    <option value="3" <c:if test="${customer.type==3}">selected</c:if>>老客户</option>
                    <option value="4" <c:if test="${customer.type==4}">selected</c:if>>代理商</option>
                    <option value="5" <c:if test="${customer.type==5}">selected</c:if>>供应商</option>
                    <option value="6" <c:if test="${customer.type==6}">selected</c:if>>合作伙伴</option>
                    <option value="7" <c:if test="${customer.type==7}">selected</c:if>>其他</option>
                </select>
            </div>
            <div class="layui-form-mid" style="color: cornflowerblue">+编辑</div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">客户来源：</label>
            <div class="layui-input-inline">
                <select name="source">
                    <option value="" <c:if test="${customer.source==''}">selected</c:if>>请选择</option>
                    <option value="1" <c:if test="${customer.source==1}">selected</c:if>>注册会员</option>
                    <option value="2" <c:if test="${customer.source==2}">selected</c:if>>朋友介绍</option>
                    <option value="3" <c:if test="${customer.source==3}">selected</c:if>>手工录入</option>
                    <option value="4" <c:if test="${customer.source==4}">selected</c:if>>客户介绍</option>
                    <option value="5" <c:if test="${customer.source==5}">selected</c:if>>电子商务</option>
                    <option value="6" <c:if test="${customer.source==6}">selected</c:if>>合作伙伴</option>
                    <option value="7" <c:if test="${customer.source==7}">selected</c:if>>广告</option>
                    <option value="8" <c:if test="${customer.source==8}">selected</c:if>>职员引介</option>
                    <option value="9" <c:if test="${customer.source==9}">selected</c:if>>市场活动</option>
                    <option value="10" <c:if test="${customer.source==10}">selected</c:if>>口头传达</option>
                    <option value="11" <c:if test="${customer.source==11}">selected</c:if>>其他</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户等级：</label>
            <div class="layui-input-inline">
                <select name="level">
                    <option value="" <c:if test="${customer.level==''}">selected</c:if>>请选择</option>
                    <option value="1" <c:if test="${customer.level==1}">selected</c:if>>☆</option>
                    <option value="2" <c:if test="${customer.level==2}">selected</c:if>>☆☆</option>
                    <option value="3" <c:if test="${customer.level==3}">selected</c:if>>☆☆☆</option>
                    <option value="4" <c:if test="${customer.level==4}">selected</c:if>>☆☆☆☆</option>
                    <option value="5" <c:if test="${customer.level==5}">selected</c:if>>☆☆☆☆☆</option>
                </select>
            </div>
            <div class="layui-form-mid" style="color: cornflowerblue">+编辑</div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">客户信用度：</label>
            <div class="layui-input-inline">
                <select name="credit">
                    <option value="" <c:if test="${customer.credit==''}">selected</c:if>>请选择</option>
                    <option value="1" <c:if test="${customer.credit==1}">selected</c:if>>☆</option>
                    <option value="2" <c:if test="${customer.credit==2}">selected</c:if>>☆☆</option>
                    <option value="3" <c:if test="${customer.credit==3}">selected</c:if>>☆☆☆</option>
                    <option value="4" <c:if test="${customer.credit==4}">selected</c:if>>☆☆☆☆</option>
                    <option value="5" <c:if test="${customer.credit==5}">selected</c:if>>☆☆☆☆☆</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">客户成熟度：</label>
            <div class="layui-input-inline">
                <select name="maturity">
                    <option value="" <c:if test="${customer.maturity==''}">selected</c:if>>请选择</option>
                    <option value="1" <c:if test="${customer.maturity==1}">selected</c:if>>A+：明确成交意向</option>
                    <option value="2" <c:if test="${customer.maturity==2}">selected</c:if>>A-：有初步成交意向</option>
                    <option value="3" <c:if test="${customer.maturity==3}">selected</c:if>>B+：关键人有成交意向</option>
                    <option value="4" <c:if test="${customer.maturity==4}">selected</c:if>>B-：关键人成交意向不确定</option>
                    <option value="5" <c:if test="${customer.maturity==5}">selected</c:if>>C+：初步联系，有意向</option>
                    <option value="6" <c:if test="${customer.maturity==6}">selected</c:if>>C-：初步联系，意向不确定</option>
                    <option value="7" <c:if test="${customer.maturity==7}">selected</c:if>>D：新建客户</option>
                    <option value="8" <c:if test="${customer.maturity==8}">selected</c:if>>E：明显拒绝</option>
                    <option value="9" <c:if test="${customer.maturity==9}">selected</c:if>>F：无效客户</option>
                </select>
            </div>
            <div class="layui-form-mid" style="color: cornflowerblue">+编辑</div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">所在地区：</label>
            <div class="layui-input-inline">
                <input type="text" name="area" value="${customer.area}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">邮政编码：</label>
            <div class="layui-input-inline">
                <input type="text" name="post_code" value="${customer.post_code}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">详细地址：</label>
        <div class="layui-input-block">
            <input type="text" style="width: 600px" name="company_address" value="${customer.company_address}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">相关文件：</label>
        <div class="layui-form-mid layui-word-aux">只可上传一个文件</div>
        <div class="layui-form-mid ">选择文件</div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">客户介绍：</label>
        <div class="layui-input-inline">
            <textarea name="description" cols="80" placeholder="" class="layui-textarea">${customer.description}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">传真地址：</label>
            <div class="layui-input-inline">
                <input type="text" name="fax_address" value="${customer.fax_address}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">公司网站：</label>
            <div class="layui-input-inline">
                <input type="text" name="company_website" value="${customer.company_website}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">法人：</label>
            <div class="layui-input-inline">
                <input type="text" name="corporation" value="${customer.corporation}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">开户银行：</label>
            <div class="layui-input-inline">
                <input type="text" name="deposit_bank" value="${customer.deposit_bank}" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">银行账号：</label>
        <div class="layui-input-block">
            <input type="text" style="width: 600px" name="bank_account" value="${customer.bank_account}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">年营业额：</label>
        <div class="layui-input-block">
            <input type="text" style="width: 600px" name="annual_sale" value="${customer.annual_sale}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">营业执照注册号：</label>
        <div class="layui-input-block">
            <input type="text" style="width: 600px" name="license_number" value="${customer.license_number}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地税登记号：</label>
        <div class="layui-input-block">
            <input type="text" style="width: 600px" name="land_tax_number" value="${customer.land_tax_number}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">国税登记号：</label>
        <div class="layui-input-block">
            <input type="text" style="width: 600px" name="national_tax_number" value="${customer.national_tax_number}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">客户创建时间：</label>
        <div class="layui-input-block">
            <input type="text" style="width: 600px" name="create_time" value="<fmt:formatDate value="${customer.create_time}" pattern="yyyy-mm-dd"></fmt:formatDate>" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item" style="width: 450px">
        <div class="layui-input-block">
            <button lay-submit lay-filter="update" class="layui-btn">保存</button>
        </div>
    </div>
</form>

<script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script>
    //一般直接写在一个js文件中
    layui.use(['layer', 'form','jquery'], function(){
        var layer = layui.layer
            ,form = layui.form;
        var $=layui.$;
        //异步提交表单
        form.on("submit(update)",function (data) {
            $.post("${pageContext.request.contextPath}/customer/update",data.field,function (result) {
                if (result.code==0){
                    layer.msg("修改成功！");
                    //刷新父窗口内容
                    parent.layui.table.reload("customerTable",{
                        page:{
                            curr:1
                        }
                    })
                    //关闭弹出
                    var index=parent.layer.getFrameIndex(window.name);//先得到当前frame层的索引
                    parent.layer.close(index);//再执行关闭
                }
            },"json")
            return false;//阻止表单提交
        })
    });
</script>

</body>
</html>


